package org.example.order.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Calendar;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("b_user")
@Schema(description = "用户实体类")
public class User {
    @TableId(value = "id",type = IdType.AUTO)
    @Schema(description = "用户ID", example = "1")
    private Long id;

    @Schema(description = "用户名", example = "user123", required = true)
    private String username;

    @Schema(description = "昵称", example = "小明")
    private String nickname;

    @Schema(description = "密码", example = "password123", accessMode = Schema.AccessMode.WRITE_ONLY)
    private String password;

    @Schema(description = "手机号", example = "13812345678")
    private String phone;

    @Schema(description = "头像URL", example = "http://example.com/avatar.jpg")
    private String avatar;

    @Schema(description = "性别(0:未知,1:男,2:女)", example = "1")
    private int gender;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "生日", example = "1990-01-01")
    private Date birthday;

    @Schema(description = "用户状态(0:禁用,1:正常)", example = "1")
    private int status;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "最后登录时间", example = "2025-06-16 05:35:21")
    private Date lastLoginTime;

    @Schema(description = "最后登录IP", example = "192.168.1.1")
    private String lastLoginIp;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间", example = "2025-01-01 00:00:00")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "更新时间", example = "2025-06-16 05:35:21")
    private Date updateTime;

    @TableLogic(value = "0", delval = "1")
    @Schema(description = "是否删除(0:未删除,1:已删除)", example = "0")
    private int isDelete;

    @Schema(description = "用户令牌", example = "1b0f003dd9eb407cadd00cec2e252897")
    private String token;

    @Schema(description = "用户描述信息", example = "这是一个普通用户")
    private String description;

}